<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pytils.numeral</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="pytils-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="pytils-module.html">Package&nbsp;pytils</a> ::
        Module&nbsp;numeral
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[show&nbsp;private&nbsp;|&nbsp;<a href="../public/pytils.numeral-module.html">hide&nbsp;private</a>]</font></td></tr>
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="pytils.numeral-module.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF MODULE DESCRIPTION =========== -->
<h2 class="module">Module pytils.numeral</h2>

Plural forms and in-word representation for numerals.
<hr/>

<!-- =========== START OF FUNCTION SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Function Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>unicode</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#choose_plural" class="summary-sig-name"><code>choose_plural</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>variants</span>)</span></code>
<br />
Choose proper case depending on amount</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <p><code>unicode</code></p>
        raise TypeError: when amount not <code>int</code> or 
        <code>float</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#in_words" class="summary-sig-name"><code>in_words</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>gender</span>)</span></code>
<br />
Numeral in words</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>unicode</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#in_words_float" class="summary-sig-name"><code>in_words_float</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>gender</span>)</span></code>
<br />
Float in words</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>unicode</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#in_words_int" class="summary-sig-name"><code>in_words_int</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>gender</span>)</span></code>
<br />
Integer in words</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>unicode</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#rubles" class="summary-sig-name"><code>rubles</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>zero_for_kopeck</span>)</span></code>
<br />
Get string for money</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>unicode</code>
</font></td>
  <td><code><span class="summary-sig"><a href="pytils.numeral-module.html#sum_string" class="summary-sig-name"><code>sum_string</code></a>(<span class=summary-sig-arg>amount</span>,
          <span class=summary-sig-arg>gender</span>,
          <span class=summary-sig-arg>items</span>)</span></code>
<br />
Get sum in words</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>tuple</code>
</font></td>
  <td><code><span class="summary-sig"><a href="../private/pytils.numeral-module.html#__sum_string_fn" class="summary-sig-name"><code>__sum_string_fn</code></a>(<span class=summary-sig-arg>into</span>,
          <span class=summary-sig-arg>tmp_val</span>,
          <span class=summary-sig-arg>gender</span>,
          <span class=summary-sig-arg>items</span>)</span></code>
<br />
Make in-words representation of single order</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>str</code>
</font></td>
  <td><code><span class="summary-sig"><a href="../private/pytils.numeral-module.html#_get_float_remainder" class="summary-sig-name"><code>_get_float_remainder</code></a>(<span class=summary-sig-arg>fvalue</span>,
          <span class=summary-sig-arg>signs</span>)</span></code>
<br />
Get remainder of float, i.e.</td></tr>
</table><br />


<!-- =========== START OF FUNCTION DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Function Details</th></tr>
</table>

<a name="choose_plural"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">choose_plural</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>variants</span>)</span>
  </h3>
  Choose proper case depending on amount
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         amount of objects
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>variants</b></code> -
         variants (forms) of object in such form: (1 object, 2 objects, 
        5 objects).
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=3-element <code>sequence</code> of 
              <code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        proper variant
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="in_words"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">in_words</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>gender</span>=<span class=sig-default>None</span>)</span>
  </h3>
  Numeral in words
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code> or <code>float</code>)</i>
      <dd><code><b>gender</b></code> -
         gender (male=1, female=2, neuter=3)
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        in-words reprsentation of numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<p><code>unicode</code></p>
        raise TypeError: when amount not <code>int</code> or 
        <code>float</code>)</i>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="in_words_float"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">in_words_float</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>gender</span>=<span class=sig-default>2</span>)</span>
  </h3>
  Float in words
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         float numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>float</code>)</i>
      <dd><code><b>gender</b></code> -
         gender (male=1, female=2, neuter=3)
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        in-words reprsentation of float numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>AssertionError</b></code> -
        when amount is not <code>float</code>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="in_words_int"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">in_words_int</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>gender</span>=<span class=sig-default>1</span>)</span>
  </h3>
  Integer in words
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>gender</b></code> -
         gender (male=1, female=2, neuter=3)
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        in-words reprsentation of numeral
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>AssertionError</b></code> -
        when amount is not <code>int</code>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="rubles"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">rubles</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>zero_for_kopeck</span>=<span class=sig-default>False</span>)</span>
  </h3>
  Get string for money
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         amount of money
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code> or <code>float</code>)</i>
      <dd><code><b>zero_for_kopeck</b></code> -
         If false, then zero kopecks ignored
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>bool</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        in-words representation of money's amount
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>AssertionError</b></code> -
        input parameters' check failed
    </dl>
  </dd></dl>
</td></tr></table>

<a name="sum_string"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">sum_string</span>(<span class=sig-arg>amount</span>,
          <span class=sig-arg>gender</span>,
          <span class=sig-arg>items</span>=<span class=sig-default>None</span>)</span>
  </h3>
  Get sum in words
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>amount</b></code> -
         amount of objects
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>gender</b></code> -
         gender of object (male=1, female=2, neuter=3)
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>items</b></code> -
         variants of object in three forms: for one object, for two 
        objects and for five objects
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=3-element <code>sequence</code> of 
              <code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        in-words representation objects' amount
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>AssertionError</b></code> -
        input parameters' check failed
    </dl>
  </dd></dl>
</td></tr></table>

<a name="__sum_string_fn"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">__sum_string_fn</span>(<span class=sig-arg>into</span>,
          <span class=sig-arg>tmp_val</span>,
          <span class=sig-arg>gender</span>,
          <span class=sig-arg>items</span>=<span class=sig-default>None</span>)</span>
  </h3>
  Make in-words representation of single order
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>into</b></code> -
         in-words representation of lower orders
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>unicode</code>)</i>
      <dd><code><b>tmp_val</b></code> -
         temporary value without lower orders
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>gender</b></code> -
         gender (male=1, female=2, neuter=3)
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      <dd><code><b>items</b></code> -
         variants of objects
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=3-element <code>sequence</code> of 
              <code>unicode</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        new into and tmp_val
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>tuple</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>AssertionError</b></code> -
        input parameters' check failed
    </dl>
  </dd></dl>
</td></tr></table>

<a name="_get_float_remainder"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">_get_float_remainder</span>(<span class=sig-arg>fvalue</span>,
          <span class=sig-arg>signs</span>=<span class=sig-default>9</span>)</span>
  </h3>
  Get remainder of float, i.e. 2.05 -&gt; '05'
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>fvalue</b></code> -
         input value
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code> or <code>float</code>)</i>
      <dd><code><b>signs</b></code> -
         maximum number of signs
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>int</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        remainder
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>str</code>)</i>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="pytils-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" width="100%"></th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on Sun Sep  3 00:01:21 2006</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>
